package com.vf.admin.common;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class JiaoYanUtils {
    public static JiaoYanUtils getInstance(){
        return new JiaoYanUtils();
    }
    public boolean isPhone(String phone) {
//        String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[4-9]))|(16[0,1,2,3,5,6,7,8,9])|(17[0,1,2,3,5,6,7,8,9])|(18[0-9])|(19[0-9]))\\d{8}$";
        String regex = "^((13[0-9])|(14[5,7,9])|(15([0-9]))|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$";
        if (phone.length() != 11) {
            //手机号应为11位数
            return false;
        } else {
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(phone);
            boolean isMatch = m.matches();
            if(!isMatch) {
                //请填入正确的手机号
            }
            return isMatch;
        }
    }

    public static void main(String[] args){
        JiaoYanUtils uTiles = new JiaoYanUtils();
        boolean result = uTiles.isPhone("15690840791");
        System.out.println(result);
    }
}
